﻿
using Autodesk.Windows;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;

using System.Windows;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
using WinApp = System.Windows.Application;



namespace Cad.Infrastructure.View
{
    public class MyRibbonButton: RibbonButton
    {
        public MyRibbonButton(string btnName,string btnText):this()
        {
            Name = btnName;// "直线";// 按钮名称
            Text = btnText;// "直线文字";// 按钮文字

        }




        public MyRibbonButton():base()
        {
          
            ShowText = true;// 显示文字
           // Image = new BitmapImage(new Uri(@"\Images\l1.png"));
            //显示大图
            //btn.LargeImage=
            //btn.Size = RibbonItemSize.Large;
            ShowImage = true;// 显示图片
            //垂直
            Orientation = System.Windows.Controls.Orientation.Vertical; //按钮排序方式
            MouseEntered += MyRibbonButton_MouseEntered;
            MouseLeft += MyRibbonButton_MouseLeft;
            //提示信息
            ToolTip = GetRibbonToolTip();

            CommandHandler= GetCommandHandler();
            CommandParameter = "Line ";
        }


        public RibbonToolTip GetRibbonToolTip()
        { 
            var tip=new RibbonToolTip();
            tip.Title = "title";
            tip.Content = "创建直线";
            tip.Command = "LINE";
            tip.ExpandedContent = "是用LINE命令，可以绘制直线";
          //  tip.ExpandedImage=new  BitmapImage(new Uri(@"\Images\l1.png"));

            return tip;
        }

        public RibbonCommandHandler GetCommandHandler()
        {
            var command = new RibbonCommandHandler();



            return command;
        }
        /// <summary>
        /// 鼠标移开
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <exception cref="NotImplementedException"></exception>
        private void MyRibbonButton_MouseLeft(object sender, EventArgs e)
        {
            
        }
        /// <summary>
        /// 鼠标进入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MyRibbonButton_MouseEntered(object sender, EventArgs e)
        {

            RibbonButton btn = (RibbonButton)sender;
            // btn.Image= 
            // 这里可以设置 大图 

        }
    }
}
